<?php defined('SYSPATH') or die('No direct script access.');

class Model_Entity extends Model_Base
{
	public function get_all_entity()
	{
		return DB::select()->from('entity')->execute()->as_array();
	}
	protected function add_entity($type, $info)
	{
		// create entity 
		$ret = $this->add('entity', array('etype' => $type));
		if ($ret[1] !== 1)
			return $ret;
		
		// create
		$table = Helper_MyConst::$ENTITY_TYPE_TABLE[$type];
		$info['id'] = $ret[0];
		$this->add($table, $info);
		return $ret;
	}
}